package com.shangcheng.users.feign;

import com.github.pagehelper.PageInfo;
import com.shangcheng.users.pojo.User;
import entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(name = "users")
@RequestMapping("/user")
public interface UserFeign {

    /**
     * @param points
     * @return entity.Result
     * @Description 给用户添加积分
     * @Date 23:44 2019/8/26
     **/
    @RequestMapping(value = "/addPoints")
    Result addPoints(@RequestParam(value = "points") Integer points, @RequestParam(value = "username") String username);

    @PostMapping(value = "/login")
    public Result auth(@RequestParam(name = "username") String username,
                       @RequestParam(name = "password") String password);


    @RequestMapping("/findByName")
    public Result<User> findByName(@RequestParam(name = "name") String name);

    @RequestMapping("/add")
    public Result add(@RequestBody User user);

    @RequestMapping(value = "/findPage")
    public Result<PageInfo> findPage(@RequestParam(name = "page") int page, @RequestParam(name = "size") int size);

    @GetMapping("/dele")
    public Result delete(@RequestParam("username") String username);
}
